package com.sise.wangzhan;

import com.sise.wangzhan.HealthController;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

/**
 * @Classname MyHealthIndicator
 * @Description TODO    健康指示器
 * @Date 2020/3/19 11:18
 * @Created by wangzhan
 */
@Component
public class MyHealthIndicator implements HealthIndicator {
    
    /**
     *
     * @Description TODO 判断健康状态
     * @param
     * @date  11:24
     * @return
     *
     */
    @Override
    public Health health() {
        if (HealthController.canVisitDb){
            return new Health.Builder(Status.UP).build();
        }else {
            return new Health.Builder(Status.DOWN).build();
        }
    }
    
}
